﻿using Compass.Wasm.Shared;
using Compass.Wasm.Shared.Plans;
using System.Net.Http.Json;

namespace Compass.Wasm.Client.Services.Plans;
public interface IFinishGoodsCountService:IBaseService<FinishedGoodsCountDto>
{
    Task<List<FinishedGoodsCountDto>> GetAllWithFeeAsync(bool showAll);
}
public class FinishGoodsCountService:BaseService<FinishedGoodsCountDto>,IFinishGoodsCountService
{
    private readonly HttpClient _http;
    private const string ServiceName = "FinishedGoodsCount";
    public FinishGoodsCountService(HttpClient http) : base(http, ServiceName)
    {
        _http = http;
    }

    public async Task<List<FinishedGoodsCountDto>> GetAllWithFeeAsync(bool showAll)
    {
        var response = await _http.GetFromJsonAsync<ApiResponse<List<FinishedGoodsCountDto>>>($"api/{ServiceName}/All/WithFee?showAll={showAll}");
        return response.Status ? response.Result : new List<FinishedGoodsCountDto>();
    }
}